<template>
  <div class="lawyer-transfer">
    <div class="bg-c-fff">
      <h2 class="box-title rel">律师转所申请</h2>
      <form @submit.prevent="onSubmit">
        <ul>
          <li>
            <span>律师姓名：</span>
            <p class="dib p">{{lawyerName}}</p>
          </li>
          <li>
            <span>所属律所：</span>
            <p class="dib p">{{firmName}}</p>
          </li>
          <li>
            <span>申请转至律所：</span>
            <select v-model="newFirmId">
              <option value="">请选择律所</option>
              <option v-for="item in lawyerFirmList" :value="item.lawyerFirmId">{{item.lawyerFirmName}}</option>
            </select>
          </li>
          <li class="button">
            <span></span>
            <input type="submit" value="提交" class="blue-button cup">
            <input type="button" value="取消" class="white-button cup">
          </li>
        </ul>
      </form>
    </div>
  </div>
</template>
<script type="text/javascript">
export default {
  data() {
    return {
      newFirmId: '',
      lawyerFirmList: []
    }
  },
  mounted() {
    console.log(this.$store.state.lawyerLoginData)
    this.$http.get('/memberLawyer/getList/revieweded/lawyerFirm', {}).then((data) => {
      if (data.data.httpCode === 200) {
        data.data.rows.forEach((i) => {
          this.lawyerFirmList.lawyerFirm = {}
          this.lawyerFirmList.lawyerFirm.lawyerFirmName = i.lawyerfirmName
          this.lawyerFirmList.lawyerFirm.lawyerFirmId = i.id
          this.lawyerFirmList.push(this.lawyerFirmList.lawyerFirm)
        })
      } else {
        this.$toasted.show(data.data.msg)
      }
    }).catch((err) => {
      console.log(err)
    })
  },
  methods: {
    onSubmit() {
      this.$http.post('/memberLawyer/join/other/lawyerfirm', {
        currentId: this.$store.state.lawyerLoginData.id,
        afterId: this.newFirmId
      }).then(data => {
        if (data.data.httpCode === 200) {
          this.$router.push('/to-examine')
        }
      })
    }
  },
  computed: {
    lawyerName() {
      return this.$store.state.lawyerLoginData.lawyerName
    },
    firmName() {
      return this.$store.state.lawyerLoginData.firmName
    }
  }
}

</script>
<style type="text/css" scoped>
.lawyer-transfer ul {
  padding-bottom: 223px;
}

.lawyer-transfer ul li {
  padding: 10px 0;
}

.lawyer-transfer ul li span {
  width: 194px;
  display: inline-block;
  text-align: right;
  color: #666666;
  margin-right: 20px;
}

.p {
  color: #666;
}

select {
  width: 121px;
  height: 35px;
}

input::-webkit-input-placeholder {
  color: #a5a5a5;
}

.button input {
  width: 150px;
  line-height: 35px;
  margin-right: 25px;
  margin-top: 20px;
}

</style>
